package com.lizhi.yun.deploy.task;

import com.lizhi.utils.DateUtils;
import com.lizhi.yun.db.sfrobot.entity.RobotStatus;
import com.lizhi.yun.db.sfrobot.repository.RobotStatusRepo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: lizhi
 * @Description:
 * @Date: create in 2020/11/18 11:20
 */
@Slf4j
@Component  //用于对那些比较中立的类进行注释；
@EnableScheduling // 开启定时任务
@EnableAsync  //开启多线程
public class RobotStatusTask {

    @Resource
    private RobotStatusRepo robotStatusRepo;


    /*@Async
    @Scheduled(cron = "0/60 * * * * ?")
    public void second() {
        List<RobotStatus> robotStatuses = robotStatusRepo.findAllByDataUpTimeBefore(DateUtils.getHistoryDate(0, -10, 0));
        log.info("获取到的数据是robotStatuses:{}", robotStatuses);
        robotStatusRepo.deleteAll(robotStatuses);
    }*/
}
